package com.bjqg.bjqg01.bjqg.dialog;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.airbnb.lottie.LottieAnimationView;
import com.bjqg.bjqg01.bjqg.R;

/**
 * Created by bjqg01 on 2018/8/29.
 */

public class IntentLoginDialog extends Dialog {


    public IntentLoginDialog(@NonNull Context context) {
        super(context);
    }

    public IntentLoginDialog(@NonNull Context context, @StyleRes int themeResId) {
        super(context, themeResId);
    }

    public static class Builder {
        private Context context; //上下文对象
        IntentLoginDialog dialog;
        public Builder(Context context) {
            this.context = context;
        }

        public IntentLoginDialog create() {
            final LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            //加载布局
            dialog = new IntentLoginDialog(context, R.style.custom_dialog2);
            View view = mInflater.inflate(R.layout.dialog_call_phon, null);
            dialog.addContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
            dialog.setCanceledOnTouchOutside(false);
            LottieAnimationView lottieAnimationView = (LottieAnimationView) view.findViewById(R.id.lottie);
            lottieAnimationView.setAnimation("twirl_particles_loading.json");
            lottieAnimationView.playAnimation();
            dialog.setContentView(view);
            return dialog;
        }
    }
}
